package com.recharge.services;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.recharge.util.DBUtil;

public class rechargemodel {
	@SuppressWarnings("finally")
	public boolean isAuthencaticated(String username,String password)
	{
		boolean flag=true;
		Connection con=null;
		PreparedStatement ps=null;
		ResultSet rs=null;
		try {
			con=DBUtil.getConnection();
			ps=con.prepareStatement("select *from register where username=? and password=?");
			ps.setString(1,username);
			ps.setString(2, password);
			rs=ps.executeQuery();
			if(rs.next())
			{
				flag =true;
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		finally{
			try {
				if(rs!=null)
				{
					rs.close();
				}
				if (ps!=null) {
					ps.close();
				}
				if (con!=null) {
					con.close();}
			} catch (final SQLException e2) {
				
			}
			return flag;
		}
	}

}
